package thread07;

public class Ticket implements Runnable{
	private int ticket=100;//初始化100张票
	private Object obj= new Object();
	@Override
	public void run() {
      //卖票
		while(true) {
			synchronized (obj){
				if(ticket>0){
				/*	try {
						Thread.sleep(100);
					} catch (InterruptedException e) {
						e.printStackTrace();
					}*/
					System.out.println(Thread.currentThread().getName()+"..."+ticket--);
				}
			}
		}
	}
}
